package org.travel.api.travel.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
public class Orderinfo implements Serializable {
    private Integer orderNo;
/*
    private String userId;
*/
    private User user = new User();
/*
    private Integer productId;
*/
    private Room room = new Room();
    private Integer payCount;
    private Integer reserveDate;
    private Date checkInDate;
    private Date checkOutDate;
/*
    private Integer dicId;
*/
    private Dictionaries dictionaries = new Dictionaries();
    private double payAmount;
    private Integer payment;
    private Date ydTime;
    private Date payDate;
    private Integer roomId;

    @Id
    @Column(name = "orderNo", nullable = false)
    public Integer getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(Integer orderNo) {
        this.orderNo = orderNo;
    }

    /*@Basic
    @Column(name = "userId", nullable = false, length = 255)
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }*/

   /* @Basic
    @Column(name = "productId", nullable = false)
    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }*/

    @Basic
    @Column(name = "payCount", nullable = true)
    public Integer getPayCount() {
        return payCount;
    }

    public void setPayCount(Integer payCount) {
        this.payCount = payCount;
    }

    @Basic
    @Column(name = "reserveDate", nullable = true)
    public Integer getReserveDate() {
        return reserveDate;
    }

    public void setReserveDate(Integer reserveDate) {
        this.reserveDate = reserveDate;
    }

    @Basic
    @Column(name = "checkInDate", nullable = false)
    public Date getCheckInDate() {
        return checkInDate;
    }

    public void setCheckInDate(Date checkInDate) {
        this.checkInDate = checkInDate;
    }

    @Basic
    @Column(name = "checkOutDate", nullable = false)
    public Date getCheckOutDate() {
        return checkOutDate;
    }

    public void setCheckOutDate(Date checkOutDate) {
        this.checkOutDate = checkOutDate;
    }

    /*@Basic
    @Column(name = "dicId", nullable = false)
    public Integer getDicId() {
        return dicId;
    }

    public void setDicId(Integer dicId) {
        this.dicId = dicId;
    }*/

    @Basic
    @Column(name = "payAmount", nullable = true, precision = 2)
    public double getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(double payAmount) {
        this.payAmount = payAmount;
    }

    @Basic
    @Column(name = "payment", nullable = true)
    public Integer getPayment() {
        return payment;
    }

    public void setPayment(Integer payment) {
        this.payment = payment;
    }

    @Basic
    @Column(name = "YDTime", nullable = true)
    public Date getYdTime() {
        return ydTime;
    }

    public void setYdTime(Date ydTime) {
        this.ydTime = ydTime;
    }

    @Basic
    @Column(name = "PayDate", nullable = true)
    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    @Basic
    @Column(name = "roomId", nullable = false)
    public Integer getRoomId() {
        return roomId;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

   /* @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Orderinfo orderinfo = (Orderinfo) o;
        return Objects.equals(orderNo, orderinfo.orderNo) &&
                Objects.equals(userId, orderinfo.userId) &&
                Objects.equals(productId, orderinfo.productId) &&
                Objects.equals(payCount, orderinfo.payCount) &&
                Objects.equals(reserveDate, orderinfo.reserveDate) &&
                Objects.equals(checkInDate, orderinfo.checkInDate) &&
                Objects.equals(checkOutDate, orderinfo.checkOutDate) &&
                Objects.equals(dicId, orderinfo.dicId) &&
                Objects.equals(payAmount, orderinfo.payAmount) &&
                Objects.equals(payment, orderinfo.payment) &&
                Objects.equals(ydTime, orderinfo.ydTime) &&
                Objects.equals(payDate, orderinfo.payDate) &&
                Objects.equals(roomId, orderinfo.roomId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderNo, userId, productId, payCount, reserveDate, checkInDate, checkOutDate, dicId, payAmount, payment, ydTime, payDate, roomId);
    }*/

   @ManyToOne
   @JoinColumn(name = "userId")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "dicId")
    public Dictionaries getDictionaries() {
        return dictionaries;
    }

    public void setDictionaries(Dictionaries dictionaries) {
        this.dictionaries = dictionaries;
    }

    @ManyToOne
    @JoinColumn(name = "productId")
    public Room getRoom() {
        return room;
    }

    public void setRoom(Room room) {
        this.room = room;
    }
}
